class Validator{
    /**
     * 手机号正则
     * @type {RegExp}
     */
    static phoneReg = /^1[3|4|5|8|7][0-9]\d{8}$/;

    /**
     * 网址正则
     * @type {RegExp}
     */
    static urlReg = new RegExp('(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]','g');


    /**
     * 纯数字
     * @type {RegExp}
     */
    // static numberReg =  /^[0-9]*$/;
    static numberReg =  /^\d+(\.\d+)?$/;

    /**
     * 正则验证1
     * @param {string} value
     * @param {string | RegExp} rule
     * @return {boolean}
     */
    static validator(value:string,rule:string|RegExp){
        let reg ;
        if(typeof  rule === 'string'){
            reg = new RegExp(rule);
        }else {
            reg = rule;
        }
        return reg.test(value );
    }

}

export default Validator;